﻿<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">
	<h:form>
		<p:wizard id="tabView" backLabel="Vissza" nextLabel="Tovább">
			<p:tab id="BasicData" title="1. Alapadatok >>" style="background-image: linear-gradient(to bottom, #000000, #000000) !important; background-">
				<p:panel >
					<h:messages />
					<div>
						<h:panelGrid columns="2" >

							<p:outputLabel for="lastName" value="Vezetéknév:" />
							<p:inputText id="lastName" required="true" value="#{customerMaintBean.customer.lastName}" />

							<p:outputLabel for="firstName" value="Keresztnév:" />
							<p:inputText id="firstName" required="true" value="#{customerMaintBean.customer.firstName}" />

							<p:outputLabel for="gender" value="Neme:" />
							<p:selectOneRadio id="gender" required="true" value="#{customerMaintBean.customer.gender}">
								<f:selectItem itemLabel="Férfi" itemValue="0" />
								<f:selectItem itemLabel="Nő" itemValue="1" />
							</p:selectOneRadio>
					
						</h:panelGrid>
					</div>
					<p:dialog widgetVar="dialog" showEffect="fade" hideEffect="fade">
						<h:panelGrid id="display" columns="2" cellpadding="5">
							<h:outputText value="#{customerMaintBean.customer.birthday}">
								<f:convertDateTime pattern="yyyy/MM/dd" />
							</h:outputText>
						</h:panelGrid>
					</p:dialog>
					<p:fieldset legend="Születési alapadatok">
						<h:panelGrid columns="2" columnClasses="label, value" styleClass="grid">

							<h:outputLabel for="birthday" value="Születési idő:" />
							<p:calendar id="birthday" required="true" value="#{customerMaintBean.customer.birthday}" maxdate="#{currentDate}" showOn="button"/>

							<!-- 							<h:outputLabel for="birthCountry" value="Ország:" /> -->
							<!-- 							<p:selectOneMenu id="birthCountry" required="true" value="#{customerMaintBean.customer.birthCountry}" immediate="true" valueChangeListener="#{customerMaintBean.valueChange}"> -->
							<h:outputLabel for="birthCountry" value="Ország:" />
							<p:inputText id="birthCountry" required="true" value="#{customerMaintBean.customer.birthCountry}" />
							<!-- 							<p:selectOneMenu value="#{customerMaintBean.customer.birthCountry}" immediate="true" valueChangeListener="#{customerMaintBean.valueChange}"> -->
							<!-- 								<p:ajax event="valueChange" update="cityChooser" /> -->
							<!-- 								<f:selectItem itemLabel="Kérem válasszon!" itemValue="" /> -->
							<!-- 								<f:selectItems value="#{mainData.countries}" /> -->
							<!-- 							</p:selectOneMenu> -->

							<!-- 							<h:outputLabel for="birthCity" value="Város:" /> -->
							<!-- 							<h:panelGroup id="cityChooser"> -->
							<!-- 								<p:selectOneMenu id="birthCity" required="true" value="#{customerMaintBean.customer.birthplace}" immediate="true" rendered="#{customerMaintBean.wasBornInHungary}"> -->
							<h:outputLabel for="birthplace" value="Város:" />
							<p:inputText id="birthplace" required="true" value="#{customerMaintBean.customer.birthplace}" />
							<!-- 							<h:panelGroup id="cityChooser"> -->
							<!-- 								<p:selectOneMenu value="#{customerMaintBean.customer.birthplace}" immediate="true" rendered="#{customerMaintBean.wasBornInHungary}"> -->
							<!-- 									<f:selectItem itemLabel="Kérem válasszon!" itemValue="" /> -->
							<!-- 									<f:selectItems value="#{mainData.cities}" /> -->
							<!-- 								</p:selectOneMenu> -->
							<!-- 								<p:inputText required="true" rendered="#{!customerMaintBean.wasBornInHungary}" value="#{customerMaintBean.customer.birthplace}" /> -->
							<!-- 							</h:panelGroup> -->

						</h:panelGrid>
					</p:fieldset>
					<p:fieldset legend="Születési név">
						<h:panelGrid columns="2" columnClasses="label, value" styleClass="grid">
							<p:outputLabel for="birthFirstName" value="Keresztnév:" />
							<p:inputText id="birthFirstName" required="true" value="#{customerMaintBean.customer.birthFirstName}" />

							<p:outputLabel for="birthLastName" value="Vezetéknév:" />
							<p:inputText id="birthLastName" required="true" value="#{customerMaintBean.customer.birthLastName}" />
						</h:panelGrid>
					</p:fieldset>
				</p:panel>
			</p:tab>

			<p:tab id="AdditionalData" title="2. További adatok >>">
				<p:panel>

					<h:messages errorClass="error" />
					<p:fieldset legend="">
						<h:panelGrid columns="2" columnClasses="label, value">

							<p:outputLabel for="citizenship" value="Állampolgárság:" />
							<p:selectOneMenu id="citizenship" required="true" value="#{customerMaintBean.customer.citizenship}">
								<f:selectItem itemLabel="Kérem válasszon!" itemValue="" />
								<f:selectItems value="#{mainData.citizenships}" />
							</p:selectOneMenu>

							<p:outputLabel for="education" value="Képzettség:" />
							<p:selectOneMenu id="education" required="true" value="#{customerMaintBean.customer.education}">
								<f:selectItem itemLabel="Kérem válasszon!" itemValue="" />
								<f:selectItems value="#{mainData.educationTypes}" />
							</p:selectOneMenu>

							<p:outputLabel for="maritalStatus" value="Családi állapot:" />
							<p:selectOneMenu id="maritalStatus" required="true" value="#{customerMaintBean.customer.maritalStatus}">
								<f:selectItem itemLabel="Kérem válasszon!" itemValue="" />
								<f:selectItems value="#{mainData.maritalStatuses}" />
							</p:selectOneMenu>

							<p:outputLabel for="residency" value="Állandó lakóhelyén:" />
							<p:selectOneMenu id="residency" required="true" value="#{customerMaintBean.customer.residency}">
								<f:selectItem itemLabel="Kérem válasszon!" itemValue="" />
								<f:selectItems value="#{mainData.residencies}" />
							</p:selectOneMenu>
						</h:panelGrid>
					</p:fieldset>
					<p:fieldset legend="Lakcím adatok">

						<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5">

							<p:outputLabel for="country" value="Ország" />
							<p:selectOneMenu id="country" required="true" value="#{customerMaintBean.customer.address.country}">
								<f:selectItem itemLabel="Kérem válasszon!" itemValue="" />
								<f:selectItems value="#{mainData.countries}" />
							</p:selectOneMenu>

							<p:outputLabel for="zipCode" value="Irányítószám:" />
							<!-- 							<p:selectOneMenu id="zipCode" required="true" value="#{customerMaintBean.customer.address.zipCode}" valueChangeListener="#{customerMaintBean.zipChanged}"> -->
							<!-- 								<p:ajax update="city" event="valueChange" /> -->
							<!-- 								<f:selectItem itemLabel="Kérem válasszon!" itemValue="" /> -->
							<!-- 								<f:selectItems value="#{mainData.zipCodes}" /> -->
							<!-- 							</p:selectOneMenu> -->
							<p:inputText id="zipCode" required="true" value="#{customerMaintBean.customer.address.zipCode}" />

							<p:outputLabel for="state" value="Állam/Megye:" />
							<p:inputText id="state" required="true" label="Állam/Megye:" value="#{customerMaintBean.customer.address.state}" />

							<!-- TODO: ennek le kellene venni a szerkeszthetőségét, mivel irányítószám alapján kitöltődik -->
							<p:outputLabel for="city" value="Város:" />
							<!-- 							<p:selectOneMenu required="true" id="city" value="#{customerMaintBean.customer.address.city}"> -->
							<!-- 								<f:selectItem itemLabel="Kérem válasszon!" itemValue="" /> -->
							<!-- 								<f:selectItems value="#{mainData.cities}" /> -->
							<!-- 							</p:selectOneMenu> -->
							<p:inputText id="city" required="true" value="#{customerMaintBean.customer.address.city}" />

							<p:outputLabel for="streetName" value="Utca:" />
							<p:inputText id="streetName" required="true" value="#{customerMaintBean.customer.address.streetName}" />

							<p:outputLabel for="houseNumber" value="Házszám:" />
							<p:inputText id="houseNumber" required="true" value="#{customerMaintBean.customer.address.houseNumber}" />

						</h:panelGrid>
					</p:fieldset>
					<p:fieldset legend="Elérhetőségek">
						<h:panelGrid columns="2" columnClasses="label, value">
							<p:outputLabel for="email" value="Email: " />
							<p:inputMask id="email" required="true" value="#{customerMaintBean.customer.emailAddress}" />

							<p:outputLabel for="mobilePhone" value="Mobiltelefon: " />
							<p:inputMask id="mobilePhone" required="true" value="#{customerMaintBean.customer.mobilePhone}" mask="+99 999999999" />

							<p:outputLabel for="wiredPhone" value="Vezetékes telelfon: " />
							<p:inputMask id="wiredPhone" required="true" value="#{customerMaintBean.customer.wiredPhone}" mask="+99 99999999" />

							<p:outputLabel for="otherPhone" value="Egyéb telefon: " />
							<p:inputMask id="otherPhone" required="false" value="#{customerMaintBean.customer.otherPhone}" mask="+99 999999999" />
						</h:panelGrid>
					</p:fieldset>
				</p:panel>
			</p:tab>

			<p:tab id="personalDocuments" title="3. Személyes dokumentumok >>">
				<p:panel>
					<h:messages errorClass="error" />
					<ui:include src="customer/addressCard.xhtml" />
					<ui:include src="customer/idCard.xhtml" />
					<ui:include src="customer/taxCard.xhtml" />
				</p:panel>
			</p:tab>

			<p:tab id="confirm" title="4. Jóváhagyás >>">
				<p:panel>
					<ui:include src="customer/confirm.xhtml" />
					<p:commandButton value="Ügyfél létrehozása" immediate="true" rendered="#{!customerMaintBean.edit}" actionListener="#{customerMaintBean.saveCustomer}" update=":form:panel :display" id="saveCustomer" action="#{navigationBean.viewSearch()}" />
					<p:commandButton value="Ügyfél módosítása" immediate="true" rendered="#{customerMaintBean.edit}" actionListener="#{customerMaintBean.modifyCustomer}" update=":form:panel :display" id="modifyCustomer" action="#{customerMaintBean.viewCustomerData()}" />
				</p:panel>
			</p:tab>

		</p:wizard>
	</h:form>

</ui:composition>